package com.yunchang.springboot.mapper.mwsfinance;

import com.yunchang.springboot.models.mwsfinance.FFbaShipmentSales;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface FFbaShipmentSalesMapper {

    int deleteByPrimaryKey(Long id);

    int insert(FFbaShipmentSales record);

    int insertSelective(FFbaShipmentSales record);

    FFbaShipmentSales selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FFbaShipmentSales record);

    int updateByPrimaryKey(FFbaShipmentSales record);

    /**
     * 根据参数获取amount的和
     * @param sellerId
     * @param orderId
     * @param sku
     * @return
     */
    Double selectSumAmountBySellerIdAndOrderIdAndSku(String sellerId,String orderId,String sku);

    /**
     * 根据参数获取quantity的和
     * @param sellerId
     * @param orderId
     * @param sku
     * @return
     */
    Integer selectSumQuantityBySellerIdAndOrderIdAndSku(String sellerId,String orderId,String sku);

    /**
     * 根据参数获取amount的和
     * @param sellerId
     * @param country
     * @param sku
     * @param amazonOrderId
     * @return
     */
    Double selectSumAmountBySellerIdAndCountryAndSkuAndAmazonOrderId(String sellerId,String country,String sku,String amazonOrderId);

    /**
     * 根据参数获取quantity的和
     * @param sellerId
     * @param country
     * @param sku
     * @param amazonOrderId
     * @return
     */
    Integer selectSumQuantityBySellerIdAndCountryAndSkuAndAmazonOrderId(String sellerId,String country,String sku,String amazonOrderId);

    /**
     * 根据时间获取对应时间段的数据
     * @param time
     * @return
     */
    List<FFbaShipmentSales> selectByCreateTime(String time);

    /**
     * 根据参数获取country
     * @param sellerId
     * @param amazonOrderId
     * @return
     */
    String selectCountryBySellerIdAndAmazonOrderId(String sellerId,String amazonOrderId);


    /**
     * 根据日期和是否生成生成出入库明细数据获取对应的数据
     * @param date
     * @param isInventoryDetails
     * @return
     */
    List<FFbaShipmentSales> selectByIsInventoryDetailsAndDate(@Param("date") String date, @Param("isInventoryDetails") Integer isInventoryDetails);

    /**
     * 根据fFbaShipmentSalesList对象集合更新是否生成财务数据的状态
     * @param fFbaShipmentSalesList
     * @return
     */
    int updateIsInventoryDetailsByFFbaShipmentSalesList(@Param("fFbaShipmentSalesList") List<FFbaShipmentSales> fFbaShipmentSalesList);
}